package com.aim.analysis.records;

/**
 * User: Avraham Shvartzon
 * Date: 12/16/14
 */
public class Scenario{

    public final  int maxFuelInventory;
    public final  int FUEL_PERCENT_COST;
    public final  int REFUEL_BY_SPACESHIP_COST;
    public final  int REFUEL_BY_SPACESHIP_TIME;

    public final  int maintenanceCost;
    public final  int maintenanceTime;

    public final  int minorCost;
    public final  int moderateCost;
    public final  int severeCost;

    public final  int minorTime;
    public final  int moderateTime;
    public final  int severeTime;

    public final  int shutDownScore;
    public final  int collisionCost;
    public final  Integer GAME_LENGTH;

    public Scenario(int maxFuelInventory, int FUEL_PERCENT_COST, int REFUEL_BY_SPACESHIP_COST,
                    int REFUEL_BY_SPACESHIP_TIME,
                    int maintenanceCost, int maintenanceTime,
                    int minorCost, int moderateCost, int severeCost,
                    int minorTime, int moderateTime, int severeTime,
                    int shutDownScore, int collisionCost,
                    Integer GAME_LENGTH) {
        this.maxFuelInventory = maxFuelInventory;
        this.FUEL_PERCENT_COST = FUEL_PERCENT_COST;
        this.REFUEL_BY_SPACESHIP_COST = REFUEL_BY_SPACESHIP_COST;
        this.REFUEL_BY_SPACESHIP_TIME = REFUEL_BY_SPACESHIP_TIME;
        this.maintenanceCost = maintenanceCost;
        this.maintenanceTime = maintenanceTime;
        this.minorCost = minorCost;
        this.moderateCost = moderateCost;
        this.severeCost = severeCost;
        this.minorTime = minorTime;
        this.moderateTime = moderateTime;
        this.severeTime = severeTime;
        this.shutDownScore = shutDownScore;
        this.collisionCost = collisionCost;
        this.GAME_LENGTH = GAME_LENGTH;
    }
    
    public static Scenario create(int maintenanceCost, int maintenanceTime, int minorCost, int minorTime){
        int maxFuelInventory = 90 * 1000;
        int FUEL_PERCENT_COST = 1;
        int REFUEL_BY_SPACESHIP_COST = 300;
        int REFUEL_BY_SPACESHIP_TIME = 10 * 1000;

        //int maintenanceCost = 5;
        //int maintenanceTime = 4 * 1000;

        //int minorCost = 100;
        int moderateCost = 250;
        int severeCost = 500;

        //int minorTime = 4 * 1000;
        int moderateTime = 8 * 1000;
        int severeTime = 15 * 1000;



        int shutDownScore = 30;
        int collisionCost = 10;
        Integer GAME_LENGTH = 6 * 60 * 1000;
        
        return new Scenario(
        maxFuelInventory,
         FUEL_PERCENT_COST,
         REFUEL_BY_SPACESHIP_COST,
         REFUEL_BY_SPACESHIP_TIME,

         maintenanceCost,
         maintenanceTime,

         minorCost,
         moderateCost,
         severeCost,

         minorTime,
         moderateTime,
         severeTime,

         shutDownScore,
         collisionCost,
        GAME_LENGTH
        );
    }

    private static Scenario scenario = null;

    public static void register(Scenario scenario){
        if (Scenario.scenario != null){
            throw new RuntimeException("scenario should initialize one time only");
        }
        Scenario.scenario = scenario;
    }


    public static Scenario instance(){
        return scenario;
    }

    public static final Scenario alertNoAlertScenario = create(5, 4000, 100, 4000);
    public static final Scenario fgnScenario = create(5, 8000, 500, 3000);
}
